<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			.bg{
				background: red;
			}
		</style>
	</head>
	<body>
	<script>
		var str = '<table>';
		var className = '';
		for(var j=1;j<=5;j++){
			className = j%2==0 ? '' : 'bg';
		//			<tr class="bg" ><td>1</td></tr>;
			str += '<tr class="'+className+'"><td>'+j+'</td></tr>';
		}
		str += '</table>';
		document.write(str);
	</script>
	</body>
</html>
